//
//  ViewController.m
//  22-QQ_MV_HomeWork
//
//  Created by 曹曹 on 16/8/12.
//  Copyright © 2016年 曹曹. All rights reserved.
//

#import "ViewController.h"
#import "AllData.h"
#import "Data.h"
#import "MV_show_play.h"
#import "Contents.h"
#import "List.h"
#import "MVList.h"
#import "Singers.h"

#define kQQ_MV_URLString @"http://i.y.qq.com/v8/fcg-bin/getmv_by_tag?cmd=mv_shows_new&g_tk=5381&uin=0&format=json&inCharset=utf-8&outCharset=utf-8&notice=0&platform=h5&needNewCode=1&_=1470996835294"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSURLSession *session = [NSURLSession sharedSession];
    NSURL *url = [NSURL URLWithString:kQQ_MV_URLString];
    NSMutableURLRequest *hotRequest = [NSMutableURLRequest requestWithURL:url];
    hotRequest.HTTPMethod = @"GET";
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:hotRequest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            NSLog(@"%@", data);
            NSError *error = nil;
            NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data
                                                                       options:NSJSONReadingMutableContainers
                                                                         error:&error];
            NSLog(@"%@", dictionary);
            
        });
    }];
    [dataTask resume];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
